﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Caching;

namespace IRC.IRepairClouds.DataLayer.Cache
{
    public class CustomCacheManager : CacheManager
    {
        protected override string Group
        {
            get { return "Custom"; }
        }

        protected override TimeSpan? SlidingExpiration
        {
            get { return TimeSpan.FromMinutes(30); }
        }

        public TC Get<TC>(Func<TC> create, string mainGroup, object[] keys = null, CacheItemPriority? cacheScavengingPriority = null, DateTimeOffset? absoluteExpiration = null, TimeSpan? slidingExpiration = null) where TC : class
        {
            return base.GetBase(create, null, new object[] { mainGroup, keys }, cacheScavengingPriority, absoluteExpiration, slidingExpiration);
        }

        public TC Get<TC>(Func<TC> create, Func<TC, IEnumerable<CachedKeys>> getCachedKeys, string mainGroup, string group, object[] keys = null, CacheItemPriority? cacheScavengingPriority = null, DateTimeOffset? absoluteExpiration = null, TimeSpan? slidingExpiration = null) where TC : class
        {
            return base.GetBase(create, getCachedKeys, new object[] { mainGroup, keys }, cacheScavengingPriority, absoluteExpiration, slidingExpiration);
        }
    }
}
